<template>
  <div class="course-progress">
    <div class="course">
      <div class="title van-ellipsis">{{ title }}</div>
      <div class="progress">
        <div class="line">
          <van-progress :percentage="progress" :show-pivot="false" color="#ffffff" track-color="rgba(255, 255, 255, 0.3)" />
        </div>
        <div class="text">进度：{{ progress }}%</div>
      </div>
    </div>

    <div class="action">
      <span>继续观看</span>
      <van-icon name="play-circle" />
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Progress } from 'vant'

Vue.use(Progress)

export default {
  props: {
    title: {
      type: String,
      default: ''
    },

    progress: {
      type: Number,
      default: 0
    }
  }
}
</script>

<style lang="less" scoped>
.course-progress {
  margin: 10px 17px;
  background: linear-gradient(to right, #82bcfc, #4b87f7);
  color: #ffffff;
  border-radius: 5px;
  padding: 11px 17px 11px 19.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .course {
    flex: 1;

    .title {
      font-weight: 500;
      font-size: 14px;
    }

    .progress {
      display: flex;
      align-items: center;
      margin: 2px 0;
      font-size: 10px;

      .line {
        width: 100px;
        margin-right: 10.5px;
      }
    }
  }

  .action {
    display: flex;
    align-items: center;
    font-size: 13px;

    span {
      margin-right: 6px;
    }
  }
}
</style>